Skip to content

Conversation

@isher2k1
Copy link

No description provided.

Copy link
Contributor

@sarakhmen sarakhmen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's improve your solution :)

*/
public boolean login(String email, String password) {
return false;
UserService userService = new UserService();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initialize this service in class fields

Comment on lines 18 to 22
if (newUser != null) {
return newUser.getPassword().equals(password);
} else {
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use ternary operator here

public boolean login(String email, String password) {
return false;
UserService userService = new UserService();
User newUser = userService.findByEmail(email);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename this variable to be clear and correct in terms of the context

@isher2k1 isher2k1 requested a review from sarakhmen October 21, 2025 11:57
Comment on lines 8 to 31
private static String str = new String("hello".toCharArray());

public static void main(String[] args) {
test("[email protected]", "1234", true);
test("[email protected]", "1234", true);
test("[email protected]", "1234", false);
test("[email protected]", "qwerty", false);
}

private static void test(String email, String password, boolean expected) {
boolean actual = authenticationService.login(email, password);
if (expected == actual) {
System.out.println("Test passed for email: " + email + " and password " + password);
} else {
System.out.print("Expected to receive " + expected + ", but was " + actual + ". ");
System.out.println("Email: " + email + ", password " + password);
}
}

public static void smth(String s) {
String s21 = str.intern();
System.out.println();
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert these changes

@isher2k1 isher2k1 requested a review from sarakhmen October 21, 2025 17:24
Copy link

@Elena-Bruyako Elena-Bruyako left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one comment

Comment on lines 8 to 9
private static String str = new String("hello".toCharArray());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Suggested change
private static String str = new String("hello".toCharArray());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants